// Copyright (C) Kumo inc. and its affiliates.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//

#include <nebula/types/meta/string_type.h>

namespace nebula {

    constexpr Type::type StringType::type_id;

    constexpr Type::type StringViewType::type_id;

    constexpr Type::type LargeStringType::type_id;


    std::string StringType::to_string(bool show_metadata) const { return "string"; }

    std::string StringViewType::to_string(bool show_metadata) const { return "string_view"; }

    std::string LargeStringType::to_string(bool show_metadata) const { return "large_string"; }

    std::string StringType::compute_fingerprint() const { return ::nebula::type_id_fingerprint(*this); }

    std::string StringViewType::compute_fingerprint() const { return ::nebula::type_id_fingerprint(*this); }

    std::string LargeStringType::compute_fingerprint() const { return ::nebula::type_id_fingerprint(*this); }

    const std::shared_ptr<DataType> &utf8() {
        static std::shared_ptr<DataType> result = std::make_shared<StringType>();
        return result;
    }

    const std::shared_ptr<DataType> &large_utf8() {
        static std::shared_ptr<DataType> result = std::make_shared<LargeStringType>();
        return result;
    }
}  // namespace nebula
